//
//  CurrencyConverterTbv.m
//  ZITHER
//
//  Created by weixin on 2019/1/9.
//  Copyright © 2019 weixn. All rights reserved.
//

#import "CurrencyConverterTbv.h"
#import "huilvlistModel.h"

@interface CurrencyConverterTbv ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong)NSMutableArray * arrM;

@end

@implementation CurrencyConverterTbv

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self defaultConfiguration];
    }
    return self;
}

-(void)setModel:(skuDetailModel *)model{
    _model = model;

    [self reloadData];
}

-(void)defaultConfiguration{
//    self.tableHeaderView = self.head;
    [self setShadowType1WithColor:[UIColor defaultShadowColor] offset:CGSizeMake(0, 3) opacity:1 radius:2];

    self.delegate = self;
    self.dataSource = self;
}

#pragma mark -- tabdelegate
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.model.officialPrices.count;
}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    //需要排序区分 cn报价
    static NSString *sectionCell = @"CurrencyConverterTbvCell";
    
    CurrencyConverterTbvCell *cell = [tableView dequeueReusableCellWithIdentifier:sectionCell];
    
    if (cell == nil) {
        cell = [[CurrencyConverterTbvCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:sectionCell];
    }
    
    cell.state = self.state;
    
    cell.model = self.model.officialPrices[indexPath.row];
    
    cell.selectionStyle = UITableViewCellSeparatorStyleNone;
    
    return cell;
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
//    STViewController *vc = [[STViewController alloc]init];
//    vc.type = STControllerTypeHiddenNavBar;
//    vc.goodId = self.arrM[indexPath.row].goodsId;
//    [self.getNav pushViewController:vc animated:YES];
    
}

-(NSMutableArray *)arrM{
    if (!_arrM) {
        _arrM = [[NSMutableArray alloc]init];
    }
    return _arrM;
}
@end
